package com.cts.tmall.com.exception;

import com.cts.tmall.com.message.RspCode;
import lombok.Getter;

/**
 * 异常
 *
 * @author leibing.song
 * @date 2020-07-16
 */
@Getter
public final class SystemException extends RuntimeException {
    private String rspCode;
    private String rspDesc;

    public SystemException(RspCode rspCode) {
        super(rspCode.getRspCode() + " - " + rspCode.getRspDesc());
        this.rspCode = rspCode.getRspCode();
        this.rspDesc = rspCode.getRspDesc();
    }

    public SystemException(RspCode rspCode, Throwable throwable) {
        super(rspCode.getRspCode() + " - " + rspCode.getRspDesc(), throwable);
        this.rspCode = rspCode.getRspCode();
        this.rspDesc = rspCode.getRspDesc();
    }

    public SystemException(RspCode rspCode, String rspDesc) {
        super(rspCode.getRspCode() + " - " + rspDesc);
        this.rspCode = rspCode.getRspCode();
        this.rspDesc = rspDesc;
    }

    public SystemException(RspCode rspCode, String rspDesc, Throwable throwable) {
        super(rspCode.getRspCode() + " - " + rspDesc, throwable);
        this.rspCode = rspCode.getRspCode();
        this.rspDesc = rspDesc;
    }
}